package ycl.common.models.res;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import ycl.common.constants.BaseConstant;
import ycl.common.models.BaseEntityRes;

import java.time.LocalDateTime;
import java.util.Collection;

/**
 * 登录用户信息
 * <p>
 * 是 SysUser 全部字段, 由于包的层级问题和逻辑问题, 不能相互依赖
 * <p>
 * 若 SysUser 有修改这里同步修改
 *
 * @author ycl
 * @date 2022-03-09 16:39:44
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("登录用户信息")
@Accessors(chain = true)
public class LoginUser extends BaseEntityRes {


	private static final long serialVersionUID = 9099524894258456151L;

	@ApiModelProperty("用户名")
	private String username;

	@ApiModelProperty("密码")
	private String password;

	@ApiModelProperty("用户头像")
	private String avatar;

	@ApiModelProperty("真实名")
	private String realName;

	@ApiModelProperty("身份证")
	private String idCard;

	@ApiModelProperty("年龄")
	private Integer age;

	@ApiModelProperty("性别，1男，0女")
	private Boolean sex;

	@ApiModelProperty("登录信息")
	private String token;

	@ApiModelProperty("用户类型，0超管，1普通用户")
	private Integer type;

	@ApiModelProperty("邀请码")
	private String invitationCode;

	@ApiModelProperty("父id，邀请人的id")
	private Long parentId;

	@ApiModelProperty("手机号")
	private String mobile;

	@ApiModelProperty("微信id")
	private String wechatId;

	@ApiModelProperty("状态，0正常，1禁用")
	private Integer status;

	@ApiModelProperty("注册时间")
	@JsonFormat(pattern = BaseConstant.DATE_TIME_PATTERN, timezone = BaseConstant.DATE_TIME_GMT8)
	private LocalDateTime registerTime;

	@ApiModelProperty("登录地址")
	private String loginIp;

	@ApiModelProperty("登录时间")
	@JsonFormat(pattern = BaseConstant.DATE_TIME_PATTERN, timezone = BaseConstant.DATE_TIME_GMT8)
	private LocalDateTime loginTime;

	@ApiModelProperty("上次登录时间")
	@JsonFormat(pattern = BaseConstant.DATE_TIME_PATTERN, timezone = BaseConstant.DATE_TIME_GMT8)
	private LocalDateTime lastLoginTime;

	@ApiModelProperty("上次登录地址")
	private String lastLoginIp;

	@ApiModelProperty("退出时间")
	@JsonFormat(pattern = BaseConstant.DATE_TIME_PATTERN, timezone = BaseConstant.DATE_TIME_GMT8)
	private LocalDateTime logoutTime;


	/**
	 * ====================================
	 * <p>
	 * 以上是 SysUser 全部字段
	 * <p>
	 * ------------------------------------
	 * <p>
	 * 以下是自定义字段
	 * <p>
	 * ====================================
	 */

	@ApiModelProperty("角色id集合")
	private Collection<Long> roleIds;

	@ApiModelProperty("权限名集合")
	private Collection<String> permissions;

	@ApiModelProperty("是否是管理员")
	private Boolean isAdmin = false;

	@ApiModelProperty("是否已绑定手机号")
	private Boolean isBindMobile = false;

	@ApiModelProperty("是否已完成认证")
	private Boolean isAuth = false;
}
